package com.sc.nft.controller;


import com.sc.nft.annotation.UserLogin;
import com.sc.nft.controller.request.IdRequest;
import com.sc.nft.dto.UserActivityTaskDTO;
import com.sc.nft.pool.UserPool;
import com.sc.nft.service.ActivityTaskService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * (ActivityTask)表控制层
 *
 * @author 王伟成
 * @since 2023-09-19 13:46:50
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("activityTask")
@Api(tags = "任务列表")
public class ActivityTaskController {
    /**
     * 服务对象
     */
    private final ActivityTaskService activityTaskService;

    @ApiOperation(value = "查询活动任务", notes = "查询活动任务", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getActivityTask", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<List<UserActivityTaskDTO>> getActivityTask(@RequestBody IdRequest idRequest) {
        return Result.success(activityTaskService.getActivityTask(UserPool.getUser(), idRequest.getId()));
    }
}
